'Endpoint to expose an activation url, this url
is sent to the user by email, when accessed the user is inserted
and activated'

@expose('/activation/<string:activation_hash>')
def activation(self, activation_hash):

    reg = self.appbuilder.sm.find_register_user(activation_hash)
    if (not reg):
        log.error(c.LOGMSG_ERR_SEC_NO_REGISTER_HASH.format(activation_hash))
        flash(as_unicode(self.false_error_message), 'danger')
        return redirect(self.appbuilder.get_url_for_index)
    if (not self.appbuilder.sm.add_user(username=reg.username, email=reg.email, first_name=reg.first_name, last_name=reg.last_name, role=self.appbuilder.sm.find_role(self.appbuilder.sm.auth_user_registration_role), hashed_password=reg.password)):
        flash(as_unicode(self.error_message), 'danger')
        return redirect(self.appbuilder.get_url_for_index)
    else:
        self.appbuilder.sm.del_register_user(reg)
        return self.render_template(self.activation_template, username=reg.username, first_name=reg.first_name, last_name=reg.last_name, appbuilder=self.appbuilder)
