Add candidate and employer templates, application form, and new password functionality
- Created 'dla-kandydata.php' template for candidates with job offers and registration options. - Developed 'dla-pracodawcy.php' template for employers detailing how Globelus works and registration for new employers. - Implemented 'advert-apply.php' for job applications, including form validation and file upload for CVs. - Added 'new-password.php' for users to set a new password with validation for password strength and matching.
This commit is contained in:
@@ -2,6 +2,41 @@
|
||||
namespace front\factory;
|
||||
class GlobelusUser
|
||||
{
|
||||
static public function email_user_exists( $email )
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> count( 'globelus_users', [ 'email' => $email ] );
|
||||
}
|
||||
|
||||
static public function save_new_password( $hash, $password, $password_retype ) {
|
||||
global $mdb, $lang;
|
||||
|
||||
if ( !$hash )
|
||||
return false;
|
||||
|
||||
if ( $password != $password_retype )
|
||||
return false;
|
||||
|
||||
if ( strlen( $password ) < 6 )
|
||||
return false;
|
||||
|
||||
$email = \front\factory\GlobelusUser::get_email_by_hash( $hash );
|
||||
if ( !$email )
|
||||
return false;
|
||||
|
||||
$register_date = \front\factory\GlobelusUser::get_register_date_by_hash( $hash );
|
||||
|
||||
if ( !$register_date )
|
||||
return false;
|
||||
|
||||
$password = md5( $register_date . $password );
|
||||
|
||||
if ( $mdb -> update( 'globelus_users', [ 'password' => $password, 'password_recovery' => 0 ], [ 'hash' => $hash ] ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function resend_activation_mail( $hash )
|
||||
{
|
||||
global $mdb, $settings, $lang;
|
||||
@@ -117,6 +152,12 @@ class GlobelusUser
|
||||
return $mdb -> get( 'globelus_users', 'email', [ 'hash' => $hash ] );
|
||||
}
|
||||
|
||||
static public function get_register_date_by_hash( $hash )
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> get( 'globelus_users', 'register_date', [ 'hash' => $hash ] );
|
||||
}
|
||||
|
||||
public static function get_hash( $user_id )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
Reference in New Issue
Block a user