Fix activation form to work with Foundation setup
This commit is contained in:
parent
8a52e50029
commit
04a7b7a620
@ -559,13 +559,13 @@ sub _validate_actcode {
|
||||
|
||||
# Check that the code has been provided and contains allowed characters
|
||||
($args -> {"actcode"}, $error) = $self -> validate_string("actcode", {"required" => 1,
|
||||
"nicename" => "{L_LOGIN_ACTCODE}",
|
||||
"nicename" => "{L_LOGIN_ACTIVATE_CODE}",
|
||||
"minlen" => 64,
|
||||
"maxlen" => 64,
|
||||
"formattest" => '^[a-zA-Z0-9]+$',
|
||||
"formatdesc" => "{L_LOGIN_ERR_BADACTCHAR}"});
|
||||
# Bomb out at this point if the code is not valid.
|
||||
return $self -> {"template"} -> load_template("error/error.tem", { "%(message)s" => "{L_LOGIN_ACTFAILED}",
|
||||
return $self -> {"template"} -> load_template("error/error.tem", { "%(message)s" => "{L_LOGIN_ACTIVATE_FAILED}",
|
||||
"%(reason)s" => $error})
|
||||
if($error);
|
||||
|
||||
@ -574,7 +574,7 @@ sub _validate_actcode {
|
||||
# we don't actually know which user is being activated until the actcode lookup is done. And generally, if
|
||||
# an act code has been set, the authmethod supports activation anyway!
|
||||
my $user = $self -> {"session"} -> {"auth"} -> activate_user($args -> {"actcode"});
|
||||
return ($self -> {"template"} -> load_template("error/error.tem", { "%(message)s" => "{L_LOGIN_ACTFAILED}",
|
||||
return ($self -> {"template"} -> load_template("error/error.tem", { "%(message)s" => "{L_LOGIN_ACTIVATE_FAILED}",
|
||||
"%(reason)s" => "{L_LOGIN_ERR_BADCODE}"}), $args)
|
||||
unless($user);
|
||||
|
||||
@ -815,6 +815,28 @@ sub _generate_signup_form {
|
||||
}
|
||||
|
||||
|
||||
## @method private @ generate_actcode_form($error)
|
||||
# Generate a form through which the user may specify an activation code.
|
||||
#
|
||||
# @param error A string containing errors related to activating, or undef.
|
||||
# @return An array of two values: the page title string, the code form
|
||||
sub _generate_actcode_form {
|
||||
my $self = shift;
|
||||
my $error = shift;
|
||||
|
||||
# Wrap the error message in a message box if we have one.
|
||||
$error = $self -> {"template"} -> load_template("error/error_box.tem", {"%(message)s" => $error})
|
||||
if($error);
|
||||
|
||||
return ("{L_LOGIN_TITLE}",
|
||||
$self -> {"template"} -> load_template("login/act_form.tem", {"%(error)s" => $error,
|
||||
"%(target)s" => $self -> build_url("block" => "login"),
|
||||
"%(url-resend)s" => $self -> build_url("block" => "login", "pathinfo" => [ "resend" ]),}),
|
||||
$self -> {"template"} -> load_template("login/extrahead.tem"),
|
||||
$self -> {"template"} -> load_template("login/extrajs.tem"));
|
||||
}
|
||||
|
||||
|
||||
## @method private @ generate_passchange_form($error)
|
||||
# Generate a form through which the user can change their password, used to
|
||||
# support forced password changes.
|
||||
@ -849,26 +871,6 @@ sub _generate_passchange_form {
|
||||
}
|
||||
|
||||
|
||||
## @method private @ generate_actcode_form($error)
|
||||
# Generate a form through which the user may specify an activation code.
|
||||
#
|
||||
# @param error A string containing errors related to activating, or undef.
|
||||
# @return An array of two values: the page title string, the code form
|
||||
sub _generate_actcode_form {
|
||||
my $self = shift;
|
||||
my $error = shift;
|
||||
|
||||
# Wrap the error message in a message box if we have one.
|
||||
$error = $self -> {"template"} -> load_template("error/error_box.tem", {"%(message)s" => $error})
|
||||
if($error);
|
||||
|
||||
return ("{L_LOGIN_TITLE}",
|
||||
$self -> {"template"} -> load_template("login/act_form.tem", {"%(error)s" => $error,
|
||||
"%(target)s" => $self -> build_url("block" => "login"),
|
||||
"%(url-resend)s" => $self -> build_url("block" => "login", "pathinfo" => [ "resend" ]),}));
|
||||
}
|
||||
|
||||
|
||||
## @method private @ generate_recover_form($error)
|
||||
# Generate a form through which the user may recover their account details.
|
||||
#
|
||||
@ -988,20 +990,18 @@ sub _generate_signedout {
|
||||
sub _generate_activated {
|
||||
my $self = shift;
|
||||
|
||||
my $target = $self -> build_url(block => "login",
|
||||
pathinfo => []);
|
||||
my $url = $self -> build_url(block => "login",
|
||||
pathinfo => []);
|
||||
|
||||
return ("{L_LOGIN_ACT_DONETITLE}",
|
||||
$self -> message_box("{L_LOGIN_ACT_DONETITLE}",
|
||||
"security",
|
||||
"{L_LOGIN_ACT_SUMMARY}",
|
||||
$self -> {"template"} -> replace_langvar("LOGIN_ACT_LONGDESC",
|
||||
{"%(url-login)s" => $self -> build_url("block" => "login")}),
|
||||
undef,
|
||||
"logincore",
|
||||
[ {"message" => "{L_LOGIN_LOGIN}",
|
||||
"colour" => "blue",
|
||||
"action" => "location.href='$target'"} ]));
|
||||
return ("{L_LOGIN_ACTIVATE_DONETITLE}",
|
||||
$self -> message_box(title => "{L_LOGIN_ACTIVATE_DONETITLE}",
|
||||
type => "account",
|
||||
summary => "{L_LOGIN_ACTIVATE_SUMMARY}",
|
||||
message => $self -> {"template"} -> replace_langvar("LOGIN_ACTIVATE_MESSAGE",
|
||||
{"%(url-login)s" => $self -> build_url("block" => "login")}),
|
||||
buttons => [ {"message" => "{L_LOGIN_LOGIN}",
|
||||
"colour" => "standard",
|
||||
"href" => "$url"} ]));
|
||||
}
|
||||
|
||||
|
||||
@ -1022,7 +1022,7 @@ sub _generate_signedup {
|
||||
summary => "{L_LOGIN_SIGNUP_SUMMARY}",
|
||||
message => "{L_LOGIN_SIGNUP_MESSAGE}",
|
||||
buttons => [ {"message" => "{L_LOGIN_ACTIVATE}",
|
||||
"colour" => "warning",
|
||||
"colour" => "standard",
|
||||
"href" => $url} ]));
|
||||
}
|
||||
|
||||
|
@ -54,18 +54,19 @@ LOGIN_SIGNUP_ALTACT = Alternatively, enter the following code in the account
|
||||
LOGIN_SIGNUP_ENJOY = Thank you for registering!
|
||||
|
||||
# Activation related
|
||||
LOGIN_ACTCODE = Activation code
|
||||
LOGIN_ACTFAILED = User account activation failed
|
||||
LOGIN_ACTFORM = Activate account
|
||||
LOGIN_ACTINTRO = Please enter your 64 character activation code here.
|
||||
LOGIN_ACTIVATE = Activate account
|
||||
LOGIN_ERR_BADACTCHAR = Activation codes may only contain alphanumeric characters.
|
||||
LOGIN_ERR_BADCODE = The provided activation code is invalid: either your account is already active, or you entered the code incorrectly. Note that the code is case sensitive - upper and lower case characters are treated differently. Please check you entered the code correctly.
|
||||
LOGIN_ACTIVATE_CODE = Activation code
|
||||
LOGIN_ACTIVATE_FAILED = User account activation failed
|
||||
LOGIN_ACTIVATE_FORM = Activate account
|
||||
LOGIN_ACTIVATE_INTRO = Please enter your 64 character activation code here.
|
||||
LOGIN_ACTIVATE_RESEND = Resend activation code
|
||||
LOGIN_ACTIVATE = Activate account
|
||||
LOGIN_ERR_BADACTCHAR = Activation codes may only contain alphanumeric characters.
|
||||
LOGIN_ERR_BADCODE = The provided activation code is invalid: either your account is already active, or you entered the code incorrectly. Note that the code is case sensitive - upper and lower case characters are treated differently. Please check you entered the code correctly.
|
||||
|
||||
# Activation done
|
||||
LOGIN_ACT_DONETITLE = Account activated
|
||||
LOGIN_ACT_SUMMARY = Activation successful!
|
||||
LOGIN_ACT_LONGDESC = Your new account has been acivated, and you can now <a href="%(url-login)s">sign in</a> using your username and the password emailed to you.
|
||||
LOGIN_ACTIVATE_DONETITLE = Account activated
|
||||
LOGIN_ACTIVATE_SUMMARY = Activation successful!
|
||||
LOGIN_ACTIVATE_MESSAGE = Your new account has been acivated, and you can now <a href="%(url-login)s">sign in</a> using your username and the password emailed to you.
|
||||
|
||||
# Recovery related
|
||||
LOGIN_RECFORM = Recover account details
|
||||
@ -116,6 +117,7 @@ LOGIN_RESEND_FAILED = Activation code resend failed
|
||||
LOGIN_RESEND_DONETITLE = Activation code resent
|
||||
LOGIN_RESEND_SUMMARY = Resend successful!
|
||||
LOGIN_RESEND_LONGDESC = A new password and an activation link have been send to your email address.<br /><br />Please check your email for a message with the subject 'Your {V_[sitename]} activation code' and follow the instructions it contains to activate your account.
|
||||
|
||||
# Force password change
|
||||
LOGIN_PASSCHANGE = Change password
|
||||
LOGIN_FORCECHANGE_INTRO = Before you continue, please choose a new password to set for your account.
|
||||
|
19
templates/default/login/act_form.tem
Normal file
19
templates/default/login/act_form.tem
Normal file
@ -0,0 +1,19 @@
|
||||
<div class="small-8 small-centered columns">
|
||||
%(error)s
|
||||
<!-- Start activate form -->
|
||||
<div class="activateform callout secondary">
|
||||
<div>{L_LOGIN_ACTIVATE_INTRO}</div>
|
||||
<form id="activateform" method="post" action="%(target)s">
|
||||
<div class="entry">
|
||||
<label for="actcode">{L_LOGIN_ACTIVATE_CODE}:<br />
|
||||
<input type="text" id="actcode" name="actcode" size="24" maxlength="64" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="contextlink">(<a href="%(url-resend)s">{L_LOGIN_ACTIVATE_RESEND}</a>)</div>
|
||||
<div class="submit clearfix">
|
||||
<input type="submit" class="button float-right nomargin" id="activate" name="activate" value="{L_LOGIN_ACTIVATE}" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- End activate form -->
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user