def confirm(pid, record, template, **kwargs):
recid = int(pid.pid_value)<EOL>token = request.view_args['<STR_LIT>']<EOL>data = EmailConfirmationSerializer.compat_validate_token(token)<EOL>if data is None:<EOL><INDENT>flash(_("<STR_LIT>"), category='<STR_LIT>')<EOL>return redirect(url_for("<STR_LIT>", pid_value=recid))<EOL><DEDENT>r = AccessRequest.query.get(data['<STR_LIT:id>'])<EOL>if not r:<EOL><INDENT>abort(<NUM_LIT>)<EOL><DEDENT>if r.status != RequestStatus.EMAIL_VALIDATION:<EOL><INDENT>abort(<NUM_LIT>)<EOL><DEDENT>r.confirm_email()<EOL>db.session.commit()<EOL>flash(_("<STR_LIT>"), category='<STR_LIT:info>')<EOL>return redirect(url_for("<STR_LIT>", pid_value=recid))<EOL>
Confirm email address.