33 lines
1,010 B
Lua
33 lines
1,010 B
Lua
local errors = {
|
|
password_not_matching = "passwords don't match!",
|
|
password_not_secure = "password is not secure enough!",
|
|
password_too_short = "password is too short!",
|
|
password_too_long = "password is too long!",
|
|
|
|
wrong_credentials = "wrong credentials... check again.",
|
|
|
|
blog_not_found = "blog not found :(",
|
|
blog_was_deleted = "blog was deleted :(",
|
|
blog_handle_taken = "blog handle is already taken",
|
|
blog_handle_invalid = "blog handle is invalid!",
|
|
blog_already_exists = "blog_already_exists",
|
|
|
|
post_not_found = "post not found :(",
|
|
|
|
user_not_found = "user not found :(",
|
|
|
|
not_logged_in = "you are not logged in!",
|
|
invalid_token = "invalid authentication, please log back in..."
|
|
}
|
|
|
|
errors.handle = function(data, code, redirect)
|
|
data.response.setCookie("error-card", code)
|
|
if redirect then
|
|
data.response.headers["Location"] = redirect
|
|
data.response.code = 302
|
|
end
|
|
end
|
|
|
|
package.loaded["./errors"] = errors
|
|
|
|
return errors
|