Update
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
07c369b46c
commit
b9b311dc1c
|
@ -32,7 +32,7 @@ pub fn untis_from_env() -> Result<untis::Client> {
|
|||
rpc_url: untis::Client::gen_rpc_url(&webuntis_url, &CONFIG.untis_school)?,
|
||||
webuntis_url,
|
||||
client_name: CONFIG.untis_client_name.to_owned(),
|
||||
user_agent: "".to_string(),
|
||||
user_agent: "untis.rs".to_string(),
|
||||
username: CONFIG.untis_username.to_owned(),
|
||||
password: CONFIG.untis_password.to_owned(),
|
||||
session: None,
|
||||
|
|
|
@ -22,7 +22,7 @@ pub struct PostPdfResponse {
|
|||
|
||||
fn gen_pdf(html: &str, path: &str) -> Result<()> {
|
||||
let dir = tempfile::tempdir()?;
|
||||
let file_path = dir.path().join("content.html");
|
||||
let file_path = dir.path().join("index.html");
|
||||
let mut file = File::create(&file_path)?;
|
||||
file.write_all(html.as_bytes())?;
|
||||
|
||||
|
|
|
@ -69,13 +69,19 @@ RUN if [ "${BUILD_ENV}" = "development" ]; then \
|
|||
xargs -I % sh -c 'mkdir -p $(dirname deps%); cp % deps%;'; \
|
||||
fi
|
||||
|
||||
FROM alpine as config
|
||||
WORKDIR /usr/src/config
|
||||
RUN mkdir ./tmp
|
||||
RUN chmod -R 1777 ./tmp
|
||||
|
||||
FROM scratch as runner
|
||||
LABEL maintainer="Dominic Grimm <dominic@dergrimm.net>" \
|
||||
org.opencontainers.image.description="Backend of Mentorenwahl" \
|
||||
org.opencontainers.image.licenses="GPL-3.0" \
|
||||
org.opencontainers.image.source="https://git.dergrimm.net/mentorenwahl/mentorenwahl" \
|
||||
org.opencontainers.image.url="https://git.dergrimm.net/mentorenwahl/mentorenwahl"
|
||||
WORKDIR /
|
||||
COPY --from=config /usr/src/config/tmp /tmp
|
||||
WORKDIR /usr/src/mentorenwahl
|
||||
COPY --from=micrate-builder /usr/src/micrate/bin/micrate ./bin/micrate
|
||||
COPY --from=builder /usr/src/mentorenwahl/db ./db
|
||||
COPY --from=builder /usr/src/mentorenwahl/deps /
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "http/client"
|
||||
require "http"
|
||||
|
||||
module Backend::Auth
|
||||
extend self
|
||||
|
|
|
@ -67,24 +67,12 @@ module Backend
|
|||
c.long = c.short
|
||||
|
||||
c.run do
|
||||
time = Time.local
|
||||
|
||||
users = Auth.users
|
||||
|
||||
students = [] of Templates::Users::Student
|
||||
users.classes.each do |cl|
|
||||
c_db = Db::Class.create!({name: cl.name})
|
||||
cl.students.each do |s|
|
||||
password = Password.generate(Password::DEFAULT_LEN)
|
||||
students << Templates::Users::Student.new(
|
||||
class_name: cl.name,
|
||||
user: Templates::Users::User.new(
|
||||
first_name: s.first_name,
|
||||
last_name: s.last_name,
|
||||
username: s.username,
|
||||
password: password
|
||||
)
|
||||
)
|
||||
user = Db::User.create!({
|
||||
username: s.username,
|
||||
password: password,
|
||||
|
@ -101,18 +89,9 @@ module Backend
|
|||
})
|
||||
end
|
||||
end
|
||||
|
||||
teachers = [] of Templates::Users::User
|
||||
Db::User.import(
|
||||
users.teachers.map do |t|
|
||||
password = Password.generate(Password::DEFAULT_LEN)
|
||||
teachers << Templates::Users::User.new(
|
||||
first_name: t.first_name,
|
||||
last_name: t.last_name,
|
||||
username: t.username,
|
||||
password: password
|
||||
)
|
||||
|
||||
Db::User.new({
|
||||
username: t.username,
|
||||
password: password,
|
||||
|
@ -125,14 +104,6 @@ module Backend
|
|||
})
|
||||
end
|
||||
)
|
||||
|
||||
html = Templates::Users.new(
|
||||
time,
|
||||
users.classes.map { |cl| {cl.name, cl.students.size} },
|
||||
students,
|
||||
teachers
|
||||
).to_s
|
||||
puts "Filepath: #{Auth.generate_pdf(html).filename}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -170,38 +141,35 @@ module Backend
|
|||
cmd.long = cmd.short
|
||||
|
||||
cmd.run do
|
||||
# print "Do you really want to reset all passwords? [y/N] "
|
||||
# exit unless gets(chomp: true).not_nil!.strip.to_b
|
||||
|
||||
time = Time.local
|
||||
|
||||
students = [] of Templates::Users::Student
|
||||
teachers = [] of Templates::Users::User
|
||||
Db::User.query.each do |user|
|
||||
# password = Password.generate(Password::DEFAULT_LEN)
|
||||
# user.password = password
|
||||
# user.save!
|
||||
password = user.password_changed ? nil : user.initial_password
|
||||
case user.role.to_api
|
||||
in Api::Schema::UserRole::Student
|
||||
students << Templates::Users::Student.new(
|
||||
class_name: user.student.not_nil!.class_model.name,
|
||||
user: Templates::Users::User.new(
|
||||
Db::User.query
|
||||
.with_student(&.with_class_model)
|
||||
.with_teacher
|
||||
.each do |user|
|
||||
password = user.password_changed ? nil : user.initial_password
|
||||
case user.role.to_api
|
||||
in Api::Schema::UserRole::Student
|
||||
students << Templates::Users::Student.new(
|
||||
class_name: user.student.not_nil!.class_model.name,
|
||||
user: Templates::Users::User.new(
|
||||
first_name: user.first_name,
|
||||
last_name: user.last_name,
|
||||
username: user.username,
|
||||
password: password
|
||||
)
|
||||
)
|
||||
in Api::Schema::UserRole::Teacher
|
||||
teachers << Templates::Users::User.new(
|
||||
first_name: user.first_name,
|
||||
last_name: user.last_name,
|
||||
username: user.username,
|
||||
password: password
|
||||
)
|
||||
)
|
||||
in Api::Schema::UserRole::Teacher
|
||||
teachers << Templates::Users::User.new(
|
||||
first_name: user.first_name,
|
||||
last_name: user.last_name,
|
||||
username: user.username,
|
||||
password: password
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
html = Templates::Users.new(
|
||||
time,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module Backend::Password
|
||||
extend self
|
||||
|
||||
DEFAULT_LEN = 10_u32
|
||||
DEFAULT_LEN = 8_u32
|
||||
DEFAULT_CHARSET = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
||||
|
|
|
@ -138,7 +138,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code><%= student.user.password %></code>
|
||||
<%- if student.user.password -%>
|
||||
<code><%= student.user.password %></code>
|
||||
<%- else -%>
|
||||
<i>Password geändert</i>
|
||||
<%- end -%>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -18,7 +18,7 @@ version: "3"
|
|||
|
||||
services:
|
||||
nginx:
|
||||
image: byjg/nginx-extras
|
||||
image: docker.io/byjg/nginx-extras
|
||||
restart: always
|
||||
volumes:
|
||||
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
|
@ -46,7 +46,7 @@ services:
|
|||
- db
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
image: docker.io/redis:alpine
|
||||
restart: always
|
||||
volumes:
|
||||
- redis:/data
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
docker compose exec backend backend "$@"
|
||||
docker compose exec backend /usr/src/mentorenwahl/bin/backend "$@"
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
docker compose exec backend micrate "$@"
|
||||
docker compose exec backend /usr/src/mentorenwahl/bin/ "$@"
|
||||
|
|
Loading…
Reference in New Issue