Commit Graph

66 Commits (77d1b6c2e768b6307daed7eba23137a2daada125)

Author SHA1 Message Date
David Goodwin 77d1b6c2e7 rename sql fields to just have mailbox.password_expiry and domain.password_expiry 6 years ago
Damien Martins e786609aa9 Adding support for password expiration. Please read README.password_expiration for more details 6 years ago
David Goodwin 9c0e1dd575 phpdoc fixes 6 years ago
Christian Boltz 24ad5cc3d8
Set $reset_by_sms even if password reset is disabled
... to avoid an "undefined variable" warning
6 years ago
Christian Boltz 3f1866d041
display phone number field only if $CONF[sms_send_function] is set
Without a way to send a SMS, asking users for their mobile number is
pointless.
6 years ago
Christian Boltz d2588a4de2
Fix phpcs whitespace breakage in initStruct etc. 6 years ago
Adrien Crivelli 15df6c1d7b
Reformat everything with PHP-Cs-Fixer 6 years ago
houmingtao 5f1ac12d72 use current time as default token_validity value 7 years ago
root 4670182d79 fix invalid value for token_validity 7 years ago
Sylvain Tissot ffb84283c2
Harden password reset process
The improvements are:

- Die with an explicit message when a user is trying to reset his lost password and the option is disabled in config
- Redirect user to main page after password change using relative URL
- Don't leak info whether user exists or has recovery info defined
- Throttle password reset requests to prevent brute force attacks
- Show phone/alt email fields in mailbox/admin edit form only when the password reset option is enabled
- Make database upgrade code compatible with other databases types
- Use the existing password generator to generate OTP. It is now stored in database, unique to each user, valid only for 1 hour and can only by used once.
7 years ago
Sylvain Tissot 9c9ba64a7f Allows a user or admin to reset his/her forgotten password with a code sent by email/SMS #18 7 years ago
Christian Boltz 23bdd02dcb broadcast-message.php, sendmail.php, MailboxHandler, *.lang:
- include mailbox name in pSendmail_result_error and
  pSendmail_result_success



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1781 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
Christian Boltz 4ce0a57e83 PFAHandler:
- add protected $searchfields = array(); - list of fields to search by
  default, if just a search term is given. This will be done with
  $search['_'], but that code is not implemented yet.
- add $this->msg['show_simple_search'] (true if $searchfields is non-empty)

list.tpl:
- display search input box and search overview only if $searchfields is
  not empty

AliasdomainHandler:
- add 'alias_domain' and 'target_domain' to $searchfields

MailboxHandler:
- add 'username' to $searchfields

AliasHandler:
- add 'address' and 'goto' to $searchfields

This effectively means that the search input box is no longer displayed
in list.php for admin, domain and fetchmail listings.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1770 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
Christian Boltz cc2b157d59 *Handler:
- add $msg['confirm'] (confirmation message when attemping to delete an
  item, displayed by list.php)

*.lang:
- add various confirm_delete_* texts needed by *Handler
- rename confirm_domain to confirm_delete_domain


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1749 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
Christian Boltz 5706f146d6 MailboxHandler:
- storemore(): store maildir in the correct variable to fix running
  mailbox_postedit script
  Fix by bit-jockey @SF,
  https://sourceforge.net/p/postfixadmin/bugs/342/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1737 a1433add-5e2c-0410-b055-b7f2511e0802
9 years ago
Christian Boltz 087dc34b01 MailboxHandler:
- check_quota(): deny creating an unlimited mailbox if domain quota is set
  (reported by idaho7 in IRC)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1736 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
Christian Boltz 7bf5b74a47 MailboxHandler, AliasHandler:
- initStruct: set "display in list" to 1 to allow searching for domain
  with list.php (nevertheless, the domain won't be displayed because
  it doesn't have a column label set)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1735 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
Christian Boltz b30292c420 MailboxHandler.php:
- storemore(): 
  - fix undefined variable if creating subfolders fails (bug#328)
  - remove some outdated TODO notes
- create_mailbox_subfolders(): add $this->id to error_log


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1693 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
Christian Boltz c5de88390e PFAHandler.php:
fix logging - log the domain instead of $this->id
- add protected $domain (used for logging)
- add function domain_from_id()
- http://sourceforge.net/p/postfixadmin/bugs/317/

AliasHandler.php:
- add function domain_from_id()

MailboxHandler.php:
- add function domain_from_id()
- init(): use $this->domain instead of splitting $this-id again



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1684 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
Christian Boltz a8b79b4548 MailboxHandler:
- validate_new_id(): make sure mailbox creation still works if the 
  alias limit for the domain is hit


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1663 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
Christian Boltz 5fcade96d5 MailboxHandler:
- read_from_db_postprocess(): avoid warning if quota is disabled in $struct


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1655 a1433add-5e2c-0410-b055-b7f2511e0802
10 years ago
Christian Boltz c11932e58c MailboxHandler:
- use better/translateable messages at various places

languages/*.lang
- add texts needed by MailboxHandler


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1585 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 2bf5df92ea functions.inc.php, DomainHandler, MailboxHandler:
- move mailbox_postdeletion() to MailboxHandler
- move domain_postcreation() and domain_postdeletion() to
  DomainHandler
- adopt those functions for usage inside the *Handler (replace
  print with $this->errormsg etc.)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1579 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 39001c3ba4 DomainHandler.php:
- add some _formatted_*() functions to get a more informative output
  (currently only used in CLI)

MailboxHandler.php:
- add TODO for reading used quota from quota/quota2 table and adding
  a formatted_quota() function



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1573 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 3b09562fb8 MailboxHandler.php:
- rewrite and simplify delete()
- also cleanup fetchmail, quota	and quota2 tables

AliasHandler.php:
- update delete() to match the workflow in other classes



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1562 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 1b74926afb PFAHandler, *Handler:
- rename _field_$field() to _validate_$field() to make the function name
  more obvious
 


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1555 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz e809d2c651 MailboxHandler.php:
- _missing_maildir(): fix forgotten $CONF usage
- cleanup outdated TODO notes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1538 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 4d9a338eb2 After hunting an "undefined index transport" error in list-domain, I
found out that the 'Config' class is too static - it shares its static
data with the 'Lang' child class. 

This caused a conflict because we have $CONF[transport] and 
$PALANG[transport], and Config::read('transport') returned the $PALANG 
text.

To fix this, all texts are now stored as $CONF[__LANG].
I also dropped the 'Lang' class.


model/Config.php:
- mark the 'Config' class as final to ensure we don't trap into the 
  "too static" problem again.
- bool(): display and log an error message if a $CONF option does not
  contain YES or NO (that would have uncovered this bug much earlier)
- add lang() and lang_f() wrapper functions to get $PALANG texts
- remove unused $__cache and $__objects

model/Lang.php:
- deleted

common.php:
- store $PALANG as $CONF[__LANG]

lots of files:
- replace Lang::read() and Lang::read_f() calls with Config::lang()
  and Config::lang_f()




git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1536 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz bb7a3ff04d model/*Handler.php and various other files
- rename $this->return to $this->result


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1534 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz f38b10cd61 PFAHandler.php:
- set(): make "field $key is missing" translateable
- store(): call db_log() even if storemore() failed


MailboxHandler.php
- storemore(): use $this->infomsg instead of flash_info
 
*.lang
- add 'missing_field' = 'Field %s is missing';
- change reate_mailbox_result_success' and
  'pCreate_mailbox_result_succes_nosubfolders'
  to "The mailbox %s ..."

en.lang, nl.lang:
- remove unused texts 'pAdminList_domain_usercontrol',
  'pAdminCreate_domain_usercontrol', 'pAdminEdit_domain_usercontrol'


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1533 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 5f94773ae4 MailboxHandler:
- fix syntax error :-/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1518 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 7b6f3e56cb MailboxHandler.php:
- create_mailbox_subfolders(), check_quota(): 
  use class variables instead of parameters
- create_mailbox_subfolders(): remove check for empty $this-id - this can 
  never happen because it would fail much earlier in the class
- check_quota(), allowed_quota(), mailbox_post_script(), 
  create_mailbox_subfolders(): mark as protected



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1517 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz f9506d97b1 MailboxHandler.php:
- new function mailbox_post_script()
  - result of merging mailbox_postcreation() and mailbox_postedit(),
    replaces those two functions
  - drop all parameters, read them from class variables instead
  - store warn message in $this->errormsg[] instead of using print
- changed function calls to use mailbox_post_script()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1516 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 73a793433e moved the following functions from functions.inc.php to MailboxHandler.php:
- check_quota ()
- allowed_quota()
- mailbox_postcreation()
- mailbox_postedit()
- create_mailbox_subfolders()

The code was moved without any changes, except
- added leading whitespace
- removed "TODO: move to MailboxHandler" ;-)


MailboxHandler:
- change function calls for moved functions


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1515 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 08c9b4e49f *.lang:
- renamed some $PALANG texts:
  - pOverview_button => go
  - pOverview_mailbox_name => name
  - pSendmail_admin => from
  - pAdminEdit_admin_username => admin
  - pEdit_alias_goto => to 
- deleted obsolete or duplicate $PALANG texts:
  - pOverview_alias_goto
  - pCreate_alias_goto
  - pEdit_alias_button
  - pEdit_mailbox_name
  - pEdit_mailbox_button
  - pViewlog_username
  - pViewlog_button
  - pAdminList_admin_username
  - pAdminList_virtual_button
  - pAdminList_virtual_alias_address
  - pAdminList_virtual_alias_goto
  - pAdminList_virtual_mailbox_name
  - pAdminEdit_domain_button
  - pAdminEdit_admin_button
  - pBroadcast_from
  - pBroadcast_send

model/*, setup.php, templates/*, users/edit-alias.php:
- update to use the renamed $PALANG texts


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1513 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 76f66ac8db *.lang:
- rename some $PALANG variables once more because smarty breaks when
  using "-"
  - add-alias => add_alias
  - add-alias-domain => add_alias_domain
  - add-mailbox => add_mailbox
  - email-address-already-exists => email_address_already_exists
  - change-password => change_password
  - password-again => password_again

model/*, setup.php, templates/*
- update to use the changed $PALANG variables


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1511 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 9c0004a431 *.lang:
- rename various $PALANG texts:
  - pMenu_create_alias => add-alias
  - pMenu_create_alias_domain => add-alias-domain
  - pMenu_create_mailbox => add-mailbox
  - pOverview_get_mailboxes => mailboxes
  - pPassword_button => change-password
  - pAdminList_domain_description => description
  - pAdminList_domain_aliases => aliases
  - pAdminEdit_domain_transport => transport
  - pAdminEdit_admin_password2 => password-again
- remove duplicate or unused $PALANG texts:
  - pOverview_alias_alias_count
  - pOverview_alias_mailbox_count
  - pOverview_get_aliases
  - pCreate_alias_domain_button
  - pCreate_alias_welcome
  - pCreate_alias_button
  - pCreate_mailbox_password2
  - pCreate_mailbox_quota_text_error
  - pCreate_mailbox_button
  - pAdminMenu_viewlog
  - pAdminMenu_create_alias
  - pAdminMenu_create_mailbox
  - pAdminList_domain_mailboxes
  - pAdminList_domain_transport
  - pAdminList_virtual_welcome
  - pAdminList_virtual_alias_alias_count
  - pAdminList_virtual_alias_mailbox_count
  - pAdminList_virtual_mailbox_username
  - pAdminList_virtual_mailbox_quota
  - pAdminEdit_domain_description
  - pAdminEdit_domain_aliases
  - pAdminEdit_domain_mailboxes
  - pAdminEdit_domain_mailboxes_text
  - pUsersMenu_password

model/*, seetup.php, templates/*
- use changed $PALANG texts


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1510 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz c70465f0e3 *.lang:
- rename $PALANG['pCreate_alias_address_text_error2'] to 
  $PALANG['email-address-already-exists']
- delete $PALANG['pCreate_mailbox_username_text_error2']

model/*:
- use new $PALANG names


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1506 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 80591f97bc *.lang:
- add $PALANG['password'] to replace duplicate texts
  -$PALANG['pLogin_password']
  -$PALANG['pCreate_mailbox_password']
  -$PALANG['pAdminEdit_admin_password']
- set $PALANG['pFetchmail_field_src_password']= $PALANG['password']; 
  (needed until fetchmail is migrated into FetchmailHandler)

model/*, setup.php, templates/*:
- use $PALANG['password'] everywhere	  


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1504 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz a1646f84b6 *.lang:
- add $PALANG['active'] = 'Active' to replace various duplicates:
  -$PALANG['pOverview_alias_active']
  -$PALANG['pOverview_alias_domain_active']
  -$PALANG['pOverview_mailbox_active']
  -$PALANG['pCreate_alias_active']
  -$PALANG['pEdit_alias_active']
  -$PALANG['pCreate_mailbox_active']
  -$PALANG['pAdminList_admin_active']
  -$PALANG['pAdminList_domain_active']
  -$PALANG['pAdminList_virtual_mailbox_active']
  -$PALANG['pAdminEdit_domain_active']
  -$PALANG['pAdminEdit_admin_active']

model/*, templates/*:
- use $PALANG['active'] everywhere


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1503 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz fcee414740 *.lang and various other files:
- rename $PALANG['pAdminList_domain_modified'] to $PALANG['last_modified']


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1500 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz d3d7249ea0 MailboxHandler.php:
- remove a TODO in store_more() (tested, works already)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1494 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 7557ed5fae PFAHandler.php, MailboxHandler.php:
- move login() to PFAHandler.php


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1485 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 8ff856df12 MailboxHandler.php:
- make login() a non-static function
- login: use $this->db_table and $this->id_field instead of hardcoded names

users/login.php, xmlrpc.php:
- adopt to now non-static MailboxHandler->login()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1484 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 9af5a5cc03 *Handler.php:
- set $db_table and $id_field in the class, not inside initStruct()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1483 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz b5aeb5a0a6 MailboxHandler:
- fix 'goto' handling
  https://sourceforge.net/p/postfixadmin/bugs/292/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1476 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 29236ffaa4 MailboxHandler.php:
some bugfixes:
- init(): let $domain always base on $this->id (also on $new)
- make mergeId dumber (by removing an error check). This can of course 
  result in an invalid mail address, but this is handled more gracefully 
  than an empty $this->id
- updateMaxquota(): use Lang::read_f instead of sprintf


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1469 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz c53400ec5f MailboxHandler.php:
- validate_new_id(): store error message in 
  $this->errormsg[$this->id_field] instead of $this->errormsg[]
- beforestore(): use first array key instead of [0] to match the
  change in validate_new_id()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1461 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 871bcbbe2f functions.inc.php:
- check_domain(), check_email(): instead of calling flash_error(),
  return string with error message - or empty string if everything is ok

model/AdminHandler.php, model/AliasHandler.php,
model/DomainHandler.php, model/MailboxHandler.php,
sendmail.php, users/edit-alias.php:
- adopt to changed check_domain() and check_email() return value


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1451 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz f92a32eae1 PFAHandler.php:
- initStruct(): add some comments
- add calledBy() and protected $called_by - calledBy() should be called if one 
  *Handler class calls another one (to avoid loops etc.)

AliasHandler.php:
- replace $called_by_MailboxHandler / MailboxAliasConfig() with $called_by
  (code moved to PFAHandler->calledBy())

MailboxHandler.php:
- beforestore(): update alias active status on edit
  (contains some whitespace changes - basically I removed "if ($this->new)"
  around most parts of the code)
- use calledBy() instead of MailboxAliasConfig()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1449 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago